package net.esj.basic.core.engine.support.validator.exception;

import java.util.Locale;
import java.util.logging.Logger;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import net.esj.basic.core.view.filter.I18NFilter;
import net.esj.basic.exception.MelonRuntimeException;
import net.esj.basic.utils.i18n.LocaleUtils;

public class MelonValidateException extends MelonRuntimeException {
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private static Logger _log = Logger.getLogger(MelonValidateException.class.getName());

	private ValidateMessage validateMessage;
	
	public MelonValidateException(String msg,ValidateMessage validateMessage){
		super(msg);
		_log.warning(msg);
		this.validateMessage = validateMessage;
	}
	
	public MelonValidateException(Throwable t,ValidateMessage validateMessage){
		super(t);
		_log.warning(t.getMessage());
		this.validateMessage = validateMessage;
	}

	public ValidateMessage getValidateMessage() {
		return validateMessage;
	}
	
	@Override
	public String getMessage() {
		return getValidateMessage().getMessage("\n");
	}
	
}
